package cn.myschool.test.day3;

import cn.myschool.dao.ExamDao;
import cn.myschool.entity.ExamResult;
import cn.myschool.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class Level1Cache {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();
        ExamDao dao=s.getMapper(ExamDao.class);
        List<ExamResult> list1 = dao.findALL();
        System.out.println(list1);
        //强制清除一级缓存
        //s.clearCache();
        List<ExamResult> list2 = dao.findALL();
        System.out.println(list1==list2);
        MybatisUtil.close(s);
    }
}
